require(['jquery','cookie','app', 'lay','getIP'], function ($) {
    if(decodeURI(new acquire().parameterMap['spack'])!=null&decodeURI(new acquire().parameterMap['spack'])!='undefined'){
        alr(decodeURI(new acquire().parameterMap['spack']));
    }
    var ctxName = $("#ctxName").val();
    var page_title = ctxName;		// 页面标题
    var two_title = '关于'+ctxName;			// 第二个卡片的标题(最好四个字)
    var key = '15771929325';	// 默认的key
    var password = '123456';	// 默认的password
// 第二个模板的内容
// var tow_content = '输入账号和密码，点击按钮登录即可';
    var tow_content =ctxName;

    $('.login-btn').click(function () {
        debugger;
        var json = {
            name: $('[name=key]').val(),
            pass: $('[name=password]').val(),
            ip:returnCitySN.cip
        }
        loadT();
        var re=playAjax("1574998957819",json);
        debugger;
        if(re.code==0){
            closeLoad();
            setCookie("token",re.data.token);
            setCookie("user",re.data.user);
            window.location.href="./vsp?code=1574998957820&token="+re.data.token;
        }
    })

// 你所有要改的代码全在这里   ↑↑↑↑↑


// 替换属性
    $('.page-title').html(page_title);
    $('title').html(page_title);
    $('[name=key]').val(key);
    $('[name=password]').val(password);
    $('.two-title').html(two_title);
    $('.tow-content').html(tow_content);

    $('#p').bind('keypress', function (event) {
        if (event.keyCode == "13") {
            $('.login-btn').click();
        }
    });

    $(function () {
        $('#switch_qlogin').click(function () {
            $('#switch_login').removeClass("switch_btn_focus").addClass('switch_btn');
            $('#switch_qlogin').removeClass("switch_btn").addClass('switch_btn_focus');
            $('#switch_bottom').animate({
                left: '0px',
                width: '70px'
            });
            $('#qlogin').css('display', 'none');
            $('#web_qr_login').css('display', 'block');
        });
        $('#switch_login').click(function () {
            $('#switch_login').removeClass("switch_btn").addClass('switch_btn_focus');
            $('#switch_qlogin').removeClass("switch_btn_focus").addClass('switch_btn');
            $('#switch_bottom').animate({
                left: '154px',
                width: '70px'
            });
            $('#qlogin').css('display', 'block');
            $('#web_qr_login').css('display', 'none');
        });
    });
});
var xhrOnProgress=function(fun) {
    xhrOnProgress.onprogress = fun; //绑定监听
    //使用闭包实现监听绑
    return function() {
        //通过$.ajaxSettings.xhr();获得XMLHttpRequest对象
        var xhr = $.ajaxSettings.xhr();
        //判断监听函数是否为函数
        if (typeof xhrOnProgress.onprogress !== 'function')
            return xhr;
        //如果有监听函数并且xhr对象支持绑定时就把监听函数绑定上去
        if (xhrOnProgress.onprogress && xhr.upload) {
            xhr.upload.onprogress = xhrOnProgress.onprogress;
        }
        return xhr;
    }
};